
<?php $this->JQuery()->javascriptCaptureStart() ?>

<?php $this->JQuery()->javascriptCaptureEnd() ?>

<?php $this->headStyle()->captureStart()?>
    #content td { padding:5px}
    #content table { border:1px #aaa solid; padding:5px; width:100%}
    #content th {font-weight:bold;}
    #content .page a {padding:2px;}
<?php $this->headStyle()->captureEnd()?>


<form method="get" name="attribute_form">
    Keyword : <input type="text" name="attribute" id="search" value="<?php if (!empty($_GET['attribute'])) { echo $_GET['attribute']; }?>"/>
    Type:
    <select name="type" id="type">
        <option value="">Select</option>
        <?php
        foreach ($this->type as $type):?>
            <option value="<?php echo $type;?>" <?php if (isset($_GET['type'])) {if ($type == $_GET['type']) { echo "selected='selected'";}}?>><?php echo $type;?></option>
        <?php endforeach;?>
    </select>
    <input type="submit" name="search_btn" id="search_btn" value="Search"/>
    <?php if (!empty($_GET['attribute'])): ?>
        <a href="<?php echo $this->geturl('list','listingAttribute', null, 'admin1')?>">View All</a>
    <?php endif; ?>
</form>

<table border="1" id="listings">
    <tr>
        <th colspan="2">
            <form method="get" name="make_form" action="<?php echo $this->geturl('addmake','listingAttribute', null, 'admin1')?>">
                Add a Make =>
                Name: <input type="text" name="name" id="name" value=""/>
                Type:
                <select name="type" id="type">
                 <option value="">Select</option>
                    <?php foreach ($this->type as $type):?>
                        <option value="<?php echo $type;?>"><?php echo $type;?></option>
                    <?php endforeach;?>            
                </select>
                <input type="submit" name="add" id="add" value="Add"/>
            </form>
        </th>
    </tr>

<?php
    if (!isset($_GET['attribute'])) {$_GET['attribute'] = '';}
    $get = $_GET; unset($get['page']);
    $pagination = $this->pagination($this->listing_number, $this->page, 15, 4, $this->geturl('list', 'listingAttribute', null, 'admin1', $get));
?>
<?php if((int)$this->listing_number == 0):?>
	No Companies are defined
<?php else:?>
    <tr>
        <th></th>
        <th style="width:800px">
            Make
        </th>
        <th>
            Type
        </th>
        <th>
            Order
        </th>
   </tr>
    <?php foreach ($this->list as $item):?>
        <tr>
            <td>
                <a href="<?php echo $this->geturl('display', 'listingAttribute', null, 'admin1', array('id'=> $item->_id))?>" target="_blank">
                  + 
               </a>
           </td>
           <td>
                <a href="<?php echo $this->geturl('display', 'listingAttribute', null, 'admin1', array('id'=> $item->_id))?>" target="_blank">
                    <?php echo $item->name; ?>
                </a>
            </td>
            <td>
                <?php echo $item->type; ?>
            </td>
            <td>
                <?php echo $item->order; ?>
            </td>
        </tr>
    <?php 
    endforeach; 
endif;
?>
</table>
<?php echo $pagination;?>
